package name.fowler.refactoring.simplestore.domain;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;

import name.fowler.refactoring.simplestore.domain.pricecode.PriceCode;

@Entity
@NamedQueries({
	@NamedQuery(name="Movie.findAll", query="SELECT m FROM Movie m"),
	@NamedQuery(name="Movie.findByTitle", query="SELECT m FROM Movie m WHERE m.title = :title")
})
public class Movie extends JPAEntity {

    private String title;
    
    @OneToOne(cascade=CascadeType.ALL) 
    private PriceCode priceCode;

    public Movie() {
    }
    
    public Movie(String title, PriceCode priceCode) {
        this.title = title;
        this.priceCode = priceCode;
    }

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public PriceCode getPriceCode() {
		return priceCode;
	}

	public void setPriceCode(PriceCode priceCode) {
		this.priceCode = priceCode;
	}

}
